﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BiffenController;
using BiffenModel;

namespace BiffenApplication
{
    public partial class MainMenu : Form
    {
        PersonsController persController;
        ShowController showController;
        public MainMenu()
        {
            persController = new PersonsController();
            showController = new ShowController();
            InitializeComponent();
        }

        private void OpretKunde()
        {
            string name = nameTxtBox.Text;
            string lName = lNameTxtBox.Text;
            string street = streetTxtBox.Text;
            string streetNo = streetNoTxtBox.Text;
            int zipCode = Convert.ToInt32(zipTxtBox.Text);
            string phoneNo = phoneTxtBox.Text;
            string mail = mailTxtBox.Text;
            DateTime birthDate = Convert.ToDateTime(birthDateTxtBox.Text);

            try
            {
                persController.NewCustomer(name, lName, street, streetNo, zipCode, phoneNo, mail, birthDate);
                statusLabel.Text = "Det lykkedes at oprette kunde";
            }
            catch (Exception)
            {
                statusLabel.Text = "Det lykkedes ikke at oprette kunde";
            }
            

            
        }

        private void opretKundeBotton_Click(object sender, EventArgs e)
        {
            OpretKunde();
        }

        private void newMovieBtn_Click(object sender, EventArgs e)
        {
            NewMovie mov = new NewMovie();
            mov.Show();
        }
    }
}
